//
//  PlayHelper.h
//  Kugou-OC
//
//  Created by BH on 16/5/10.
//  Copyright © 2016年 Sunny. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

typedef void (^SuccessBlock)(id JSON);
typedef void (^FailureBlock)(NSError *error);

typedef enum {
    kPlayModeSerious,//顺序播放
    kPlayModeRandom,//随机播放
    kPlayModeCycle //循环播放
}PlayMode;

@interface PlayHelper : NSObject

@property (nonatomic, strong) AVQueuePlayer *aPlayer;
@property(nonatomic,assign)PlayMode playMode;//播放模式

+(instancetype)sharePlayHelper;

/**
 *  获取本地音乐列表
 *
 *  @return 本地音乐列表
 */
-(NSArray *)getLocalMusic;

/**
 *  根据hash获取音乐下载地址
 *
 *  @param hash 音乐的hash码
 *  @param method async/sync
 *  @param success 请求成功回调
 *  @param failure 请求失败回调
 */
-(void)getMusicUrlWithParam:(NSDictionary *)param method:(NSString *)method success:(SuccessBlock)success failure:(FailureBlock)failure;

/**
 *  下载音乐
 *
 *  @param url 下载地址
 *  @param method async/sync
 *  @param filename 文件名
 *  @param success 请求成功回调
 *  @param failure 请求失败回调
 */
-(void)downloadMusicWithUrl:(NSString *)url method:(NSString *)method param:(NSDictionary *)param filename:(NSString *)filename  success:(SuccessBlock)success failure:(FailureBlock)failure;

@end
